<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon-16x16-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="../css/theme-pace.css">
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"website.gitee.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况前言&amp;#8194;&amp;#8194;自es6更新以来一直受到各个前端码农喜爱(当然包括我在内),一次写传统项目的时候用到了es6语法,在chrome、firefox上运行都好好的,但一放在魔教IE浏览器上就不动弹了.总不能把项目上的es6语法都改为es5吧,于是我就在网上找了许多方法。终于踏破铁鞋无觅处:">
<meta property="og:type" content="article">
<meta property="og:title" content="IE低版本不支持ES6语法的解决方案">
<meta property="og:url" content="https://website.gitee.io/2020/12/15/es6Compatible/index.html">
<meta property="og:site_name" content="别林小筑">
<meta property="og:description" content="该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况前言&amp;#8194;&amp;#8194;自es6更新以来一直受到各个前端码农喜爱(当然包括我在内),一次写传统项目的时候用到了es6语法,在chrome、firefox上运行都好好的,但一放在魔教IE浏览器上就不动弹了.总不能把项目上的es6语法都改为es5吧,于是我就在网上找了许多方法。终于踏破铁鞋无觅处:">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-12-15T09:10:21.000Z">
<meta property="article:modified_time" content="2020-12-16T07:12:24.749Z">
<meta property="article:author" content="蓝眸">
<meta property="article:tag" content="javascript">
<meta property="article:tag" content="浏览器">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://website.gitee.io/2020/12/15/es6Compatible/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>

  <title>IE低版本不支持ES6语法的解决方案 | 别林小筑</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container">

    <header class="header header-view" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-cont"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">别林小筑</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">web前端</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>






<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-首页">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i><span>首页</span></a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i><span>Tags</span></a>

  </li>
        <li class="menu-item menu-item-列表">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i><span>列表</span></a>

  </li>
        <li class="menu-item menu-item-关于博主">

    <a href="/intro" rel="section"><i class="fa fa-archive fa-fw"></i><span>关于博主</span></a>

  </li>
        <li class="menu-item menu-item-友情链接">

    <a href="/friend" rel="section"><i class="fa fa-archive fa-fw"></i><span>友情链接</span></a>

  </li>
  </ul>
</nav>


<div class="header-weather">
    <div class="header-weather-cont">
       <iframe width="350" scrolling="no" height="70" frameborder="0" allowtransparency="true" src="https://i.tianqi.com?c=code&id=37&icon=4&site=12" style="color:#555;"></iframe>
    </div>
</div>



</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://website.gitee.io/2020/12/15/es6Compatible/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/laji02.png">
      <meta itemprop="name" content="蓝眸">
      <meta itemprop="description" content="欢迎来到林中小筑小憩，本站收录一些我在开发时收集的一些笔记和我对前端技术认知和见解。如有不对之处，还望不吝赐教。">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="别林小筑">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          IE低版本不支持ES6语法的解决方案
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2020-12-15 17:10:21" itemprop="dateCreated datePublished" datetime="2020-12-15T17:10:21+08:00">2020-12-15</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2020-12-16 15:12:24" itemprop="dateModified" datetime="2020-12-16T15:12:24+08:00">2020-12-16</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况"><a href="#该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况" class="headerlink" title="该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况"></a>该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况</h2><h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>&#8194;&#8194;自es6更新以来一直受到各个前端码农喜爱(当然包括我在内),一次写传统项目的时候用到了es6语法,在chrome、firefox上运行都好好的,但一放在魔教IE浏览器上就不动弹了.总不能把项目上的es6语法都改为es5吧,于是我就在网上找了许多方法。终于踏破铁鞋无觅处:</p>
<a id="more"></a>
<p>1、下载browser.min.js 奉上百度云的地址<a target="_blank" rel="noopener" href="https://pan.baidu.com/s/1Exy4HrX5Y9hZ0u6-GzDDCw">https://pan.baidu.com/s/1Exy4HrX5Y9hZ0u6-GzDDCw</a><br>2、引入到项目文件中 如下:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--</span><br><span class="line">    提示：</span><br><span class="line">        一定要加  type&#x3D;&quot;text&#x2F;javascript&quot; 否则浏览器还是不识别</span><br><span class="line">--&gt;</span><br><span class="line"></span><br><span class="line">&lt;script type&#x3D;&quot;text&#x2F;javascript src&#x3D;&quot;browser.min.js&quot;&gt;&lt;&#x2F;script&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>3、项目用使用es6语法的script标签要改为:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type&#x3D;&quot;text&#x2F;babel&quot;&gt;&lt;&#x2F;script&gt;</span><br></pre></td></tr></table></figure>
<p>否则浏览器依旧无法识别</p>
<p>4、代码:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">&lt;body&gt;</span><br><span class="line"></span><br><span class="line">    &lt;div id&#x3D;&quot;div&quot;&gt;&lt;&#x2F;div&gt;</span><br><span class="line"></span><br><span class="line">    &lt;script type&#x3D;&quot;babel&quot;&gt;</span><br><span class="line">        class Index&#123;</span><br><span class="line">            constructor()&#123;</span><br><span class="line">                var a &#x3D; &#96;解析成功&#96;;</span><br><span class="line">                this.show(a);</span><br><span class="line">            &#125;</span><br><span class="line">            show(a)&#123;</span><br><span class="line">                console.log(a);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &lt;&#x2F;script&gt;</span><br><span class="line"></span><br><span class="line">    &lt;script type&#x3D;&quot;text&#x2F;javascript&quot; src&#x3D;&quot;browser.min.js&quot;&gt;&lt;&#x2F;script&gt;</span><br><span class="line">&lt;&#x2F;body&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

    </div>
    
    <div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束&nbsp;<i class="fa fa-paw"></i>&nbsp;感谢您的阅读-------------</div>
    
</div>
  
</div>
    
    
    
        <div class="reward-container">
  <div>请我吃包辣条吧~</div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      <div style="display: inline-block;">
        <img src="/images/weixin.png" alt="蓝眸 微信">
        <p>微信</p>
      </div>
      <div style="display: inline-block;">
        <img src="/images/zfb.png" alt="蓝眸 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/javascript/" rel="tag"># javascript</a>
              <a href="/tags/%E6%B5%8F%E8%A7%88%E5%99%A8/" rel="tag"># 浏览器</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/12/14/crossDomain/" rel="prev" title="前端解决跨域">
      <i class="fa fa-chevron-left"></i> 前端解决跨域
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/12/16/asynchronouspgm/" rel="next" title="Javascript异步编程">
      Javascript异步编程 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%AF%A5%E6%96%B9%E6%A1%88%E9%92%88%E5%AF%B9%E4%BA%8E%E4%BC%A0%E7%BB%9F%E9%A1%B9%E7%9B%AE%E4%BD%BF%E7%94%A8es6%E6%96%B0%E7%89%B9%E6%80%A7%E5%9C%A8ie%E4%BD%8E%E7%89%88%E6%9C%AC%E5%8D%B4%E4%B8%8D%E8%AE%A4%E8%AF%86%E7%9A%84%E6%83%85%E5%86%B5"><span class="nav-number">1.</span> <span class="nav-text">该方案针对于传统项目使用es6新特性在ie低版本却不认识的情况</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%89%8D%E8%A8%80"><span class="nav-number">1.1.</span> <span class="nav-text">前言</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="蓝眸"
      src="/images/laji02.png">
  <img src="../images/author_name.png" />
  <div class="site-description" itemprop="description">欢迎来到林中小筑小憩，本站收录一些我在开发时收集的一些笔记和我对前端技术认知和见解。如有不对之处，还望不吝赐教。</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives">
          <span class="site-state-item-count">3</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">tags</span>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">蓝眸</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a>
  </div>

        








      </div>
    </footer>
  </div>
 <canvas id="canvas"></canvas>
  
  <script src="/lib/anime.min.js"></script>

<script src="/js/utils.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  


  <script src="../js/jquery-3.4.1.min.js"></script>
  <script type="text/javascript">
  var windowWidth = $(window).width();
  if (windowWidth > 480) {
    document.write('<script type="text/javascript" src="../js/snow.js"><\/script>');
  }
</script>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/assets/z16.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"log":false});</script></body>
</html>
